package com.app.asktom.component;

import java.io.ByteArrayOutputStream;

import com.app.asktom.R;
import com.app.asktom.ViewDetailActivity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

public class LazyAdapterExt extends LazyAdapter {

	protected String[] photoTitle;
	protected String[] thumbsUp;
//	protected String[] thumbDown;
	protected String[] photoId;
	protected int picId;
	
	public LazyAdapterExt(Activity a, String[] photoUrl, String[] title, 
			String thumbsUp[], String[] id) {
		super(a, photoUrl);
		this.photoTitle = title;
		this.thumbsUp = thumbsUp;
//		this.thumbDown = thumbsDown;
		this.photoId = id;
	}
	
	
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.item, null);

        TextView title=(TextView)vi.findViewById(R.id.txttitle);
        RatingBar rating = (RatingBar)vi.findViewById(R.id.ratingBar1);
        
//        TextView text=(TextView)vi.findViewById(R.id.text);
        ImageView image=(ImageView)vi.findViewById(R.id.image);
        title.setText(this.photoTitle[position] );
//        text.setText(" SPOON:" + 
//        		this.thumbsUp[position] );
        rating.setEnabled(false);
        rating.setFocusable(false);
        rating.setRating(Float.parseFloat(this.thumbsUp[position]));
        picId = position;        
        imageLoader.DisplayImage(data[position], image);
        
        
        return vi;
//		return super.getView(position, convertView, parent);
	}

}
